<%@ include file="/common/taglibs.jsp"%>

<head>
    <title><fmt:message key="mainMenu.title"/></title>
    <meta name="heading" content="<fmt:message key='mainMenu.heading'/>"/>
    <meta name="menu" content="MainMenu"/>
</head>

${param.xss}

<div class="separator"></div>
<br/>

<div style="margin-bottom:10px;height:45px;">
	<ul class="glassList" style="float:right;">
	    <li>
	    </li>
	</ul>
</div>

<div style="padding-left:30px;">
	<table>
		<tr>
			<td class="inputField" nowrap="nowrap">Username :</td>
			<td class="inputTextBox"><input type="text" cssClass="text medium required" style="width:250px;" value="${user.username}" disabled="disabled"/></td>
		</tr>
		<tr>
			<td class="inputField" nowrap="nowrap">First Name :</td>
			<td class="inputTextBox"><input type="text" cssClass="text medium required" style="width:250px;" value="${user.firstName}" disabled="disabled"/></td>
		</tr>
		<tr>
			<td class="inputField" nowrap="nowrap">Last Name :</td>
			<td class="inputTextBox"><input type="text" cssClass="text medium required" style="width:250px;" value="${user.lastName}" disabled="disabled"/></td>
		</tr>
		<tr>
			<td class="inputField" nowrap="nowrap">Email :</td>
			 <td class="inputTextBox"><input type="text" cssClass="text medium required" style="width:250px;" value="${user.email}" disabled="disabled"/></td>

		</tr>
		<tr>
			<td class="inputField" nowrap="nowrap">Mobile Number :</td>
			<td class="inputTextBox"><input type="text" cssClass="text medium required" style="width:250px;" value="${user.phoneNumber}" disabled="disabled"/></td>  
		</tr>
		<tr>
			<td class="inputField" nowrap="nowrap">Address :</td>
			 <td class="inputTextBox"><input type="text" cssClass="text medium required" style="width:250px;" value="${user.address}" disabled="disabled"/></td>  
		</tr>
		<tr>
			<td class="inputField" nowrap="nowrap">
		    <a  id="change_password_popup" href="javascript:void(0);">Change Password</a> 
			</td>
			 <td class="inputTextBox">
<!--			 <a class="button-green" href="<c:url value='/changePassword'/>">Change Password</a> -->
			 
			 </td>  
		</tr>
	</table>
	 <div id="show_change_password_popup"  style="display:none;">
			     <script>
jQuery(document).ready(function(){
	jQuery("#pwdForm").validate();
});
</script>

<s:form name="pwdForm" id="pwdForm" action="updatePassword" method="post" validate="true">
	<s:hidden id="user.id" name="user.id"/>
    <input type="hidden" name="encryptPass" value="true" />
   
	<%-- <li class="buttonBar right">
		<s:submit id="save" value="Change Password" onclick="return onFormSubmit(this.form)"/>
		<s:submit key="button.cancel" method="cancel"/>
	</li> --%>
   	<table>
		<tr>
			<td class="inputField" nowrap="nowrap">Current Password</td>
			<td class="inputTextBox"><s:password id="currentPassword" name="currentPassword" cssClass="text medium required" required="true"/></td>
		</tr>
   	 
  		 <tr>
			<td class="inputField" nowrap="nowrap">New Password</td>
			<td class="inputTextBox"><s:password id="password" name="password"  required="true" cssClass="text medium required"/></td>
		</tr>
   		 <tr>
			<td class="inputField" nowrap="nowrap"">Confirm Password</td>
			<td class="inputTextBox"><s:password  id="confirmPassword" name="confirmPassword"  required="true" cssClass="text medium required"/></td>
		</tr>
    </table>
    <li class="buttonBar bottom">
        <s:submit id="save" value="Change Password" class="button-green" onclick="return onFormSubmit(this.form)"/>
        <s:submit key="button.cancel" method="cancel" class="button-green"/>
    </li>
</s:form>

<script type="text/javascript">
<!-- This is here so we can exclude the selectAll call when roles is hidden -->
function onFormSubmit(theForm) {
  var currentPassword = document.getElementById(('currentPassword').value;
  var password = document.getElementById(('password').value;
  var confirmPassword = document.getElementById(('confirmPassword').value;
  if(password != confirmPassword){
	 alert("Password and Confirm Password should be same");	
	 return false;
  }
  if(currentPassword==password){
	  alert("Current Password and New Password is same. Please change");
	  return false;
  }
  return true;
}
</script>   
			 </div>
	<script>
  $('#change_password_popup').click(function(){
	  
	  $('#show_change_password_popup').toggle();
  });

</script>
</div>
	
